package com.ljx.stream.stream01;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @author LJX
 * @Description: TODO
 * @Date: 2022/11/5 9:42
 * @Version 1.0
 */
public class Stream04 {
	public static void main(String[] args) {
		List<Integer> list1 = new ArrayList<>();
		List<Integer> list2 = new ArrayList<>();
		Collections.addAll(list1,22,13,14,15);
		Collections.addAll(list2,22,23,24,25);
//		List<Integer> collect = Stream.concat(list1.stream(), list2.stream()).distinct().collect(Collectors.toList());
//		System.out.println(collect);
//		list1.stream().skip(2).limit(2).forEach(System.out::println);
//		list1.stream().map(t->t>14).forEach(System.out::println);
//		Optional<Integer> min = list1.stream().max(((o1, o2) -> o1 > o2 ? o1:o2));
//		System.out.println(min.get());
//		Optional<Integer> man = list1.stream().max(((o1, o2) -> o1 > o2 ? o1:o2));
//		System.out.println(man.get());
/*
		long count = list2.stream().count();
		System.out.println(count);

		Optional<Integer> first = list1.stream().findFirst();
		System.out.println(first.get());*/

		/*Optional<Integer> any = list1.parallelStream().findAny();
		System.out.println(any.get());
*/
		/*boolean b = list1.stream().allMatch(t -> t > 20);
		System.out.println(b);
		boolean b1 = list2.parallelStream().anyMatch(t -> t > 23);
		System.out.println(b1);*/

	/*	Optional<Integer> reduce = list1.stream().reduce((o1, o2) -> o1 > o2 ? o1 : o2);
		System.out.println(reduce.get());*/
	/*	Optional<Integer> reduce1 = list1.stream().reduce((o1, o2) -> o1 < o2 ? o1 : o2);
		System.out.println(reduce1.get());*/
	}
}
